package com.findmeastore.action;

import org.apache.log4j.Logger;

import com.findmeastore.bc.IBrandBc;
import com.findmeastore.bc.ICategoryBc;
import com.findmeastore.bc.ILocalityBc;
import com.findmeastore.bc.IProductBc;

public class IndexAction {
	static final Logger logger = Logger.getLogger(IndexAction.class);
	private Integer totalBusinesses;
	private Integer totalCategories;
	private Integer totalProducts;
	private Integer totalBrands;
	private Integer totalUsers;
	private Integer totalCities;
	private Integer totalLocalities;
	
	private ICategoryBc categoryBc;
	private ILocalityBc localityBc;
	private IBrandBc brandBc;
	private IProductBc productBc;
	
	public String execute() {
		logger.info("Fetching summary data for index page");
		setTotalCategories(categoryBc.getTotalCategoryCount());
		setTotalProducts(productBc.getTotalProductCount());
		setTotalBrands(brandBc.getTotalBrandCount());
		setTotalLocalities(localityBc.getTotalLocalityCount());
		setTotalCities(localityBc.getTotalCityCount());
		return "SUCCESS";
	}
	
	public Integer getTotalBusinesses() {
		return totalBusinesses;
	}
	public void setTotalBusinesses(Integer totalBusinesses) {
		this.totalBusinesses = totalBusinesses;
	}
	public Integer getTotalCategories() {
		return totalCategories;
	}
	public void setTotalCategories(Integer totalCategories) {
		this.totalCategories = totalCategories;
	}
	public Integer getTotalProducts() {
		return totalProducts;
	}
	public void setTotalProducts(Integer totalProducts) {
		this.totalProducts = totalProducts;
	}
	public Integer getTotalBrands() {
		return totalBrands;
	}
	public void setTotalBrands(Integer totalBrands) {
		this.totalBrands = totalBrands;
	}
	public Integer getTotalUsers() {
		return totalUsers;
	}
	public void setTotalUsers(Integer totalUsers) {
		this.totalUsers = totalUsers;
	}
	public Integer getTotalCities() {
		return totalCities;
	}
	public void setTotalCities(Integer totalCities) {
		this.totalCities = totalCities;
	}
	public Integer getTotalLocalities() {
		return totalLocalities;
	}
	public void setTotalLocalities(Integer totalLocalities) {
		this.totalLocalities = totalLocalities;
	}

	public ILocalityBc getLocalityBc() {
		return localityBc;
	}

	public void setLocalityBc(ILocalityBc localityBc) {
		this.localityBc = localityBc;
	}

	public IBrandBc getBrandBc() {
		return brandBc;
	}

	public void setBrandBc(IBrandBc brandBc) {
		this.brandBc = brandBc;
	}

	public ICategoryBc getCategoryBc() {
		return categoryBc;
	}

	public void setCategoryBc(ICategoryBc categoryBc) {
		this.categoryBc = categoryBc;
	}

	public IProductBc getProductBc() {
		return productBc;
	}

	public void setProductBc(IProductBc productBc) {
		this.productBc = productBc;
	}
}
